package org.black.phoneUtility.app.fragment;

import org.black.phoneUtility.MainActivity;
import org.black.phoneUtility.R;

import android.app.Activity;
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

public class PasswordProtectionFragment extends Fragment implements
		View.OnClickListener {
	public static final String TAG = PasswordProtectionFragment.class.getName();

	@Override
	public void onAttach(Activity activity) {
		super.onAttach(activity);
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		Bundle bundle = getActivity().getIntent().getExtras();
		if (bundle == null) {
			// update password verify to false
		} else {
			// if password is verify and time less 
		}
		View result = inflater.inflate(R.layout.password_protection, container,
				false);

		Button passwordOkButton = (Button) result
				.findViewById(R.id.passwordOkButton);
		passwordOkButton.setOnClickListener(this);
		return result;
	}

	@Override
	public void onDestroyView() {
		super.onDestroyView();
	}

	@Override
	public void onClick(View v) {
		getActivity().finish();
		Intent intent = new Intent(getActivity(), MainActivity.class);
		Bundle bundle = getActivity().getIntent().getExtras();
		if (bundle != null) {
			intent.putExtras(getArguments());
		}
		startActivity(intent);

	}

}
